package com.helloandroid.services

import android.app.Service
import android.content.Intent
import android.os.IBinder
import android.util.Log
import com.helloandroid.tools.MyLog
import java.util.*

class TestServer: Service() {
    var counter = 1
    override fun onCreate() {
        super.onCreate()
        MyLog.info("========TestServer onCreate called!")
        Timer().schedule(object:TimerTask(){
            override fun run() {
                Log.e("MyLog","TestServer================ counter:${counter}")
                counter++
            }
        },0,1000L)
    }
    override fun onBind(intent: Intent?): IBinder? {
        return null
    }

    override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
        MyLog.info("========TestServer onStartCommand called!")
        return super.onStartCommand(intent, flags, startId)
    }

    override fun onDestroy() {
        super.onDestroy()
        MyLog.info("========TestServer onDestroy called!")
    }
}